< previous page page_984 next page >

Page 984
6. You cannot use pessimistic locks on an ODBC data source. ODBC data sources use optimistic locking only.
7. When cascading deletes are used in a relationship, each time a base table element is deleted, all foreign table records that contain that element are deleted.
8. You use transaction management in your applications to provide an opportunity to reverse a series of database updates if your program fails to complete all requested data changes. This is particularly useful if you have processes that affect multiple tables within the database. Failure to fully complete such a transaction could lead to a database that has lost or inaccurate data. This can also result in a database that is difficult or impossible to repair.
9. The limitations of transactions include the following:
e7ae6bd512ad4c3583017fcda52f57ae.gif
· Some database formats do not support transactions.
e7ae6bd512ad4c3583017fcda52f57ae.gif
· Datasets that are the result of some SQL JOIN or WHERE clause, and datasets that contain data from attached tables do not support transactions.
e7ae6bd512ad4c3583017fcda52f57ae.gif
· Transaction operations are kept on the local workstations, which could lead to errors if the process runs out of space in the TEMP directory.
10. Declaring a unique workspace object is not required; however, it is highly recommended that you do so because transactions apply to an entire workspace.
Answers to Day 17 Exercises
1. Enter the following code to load a database exclusively when you bring up a form:
Private Sub Form_Load()

    Dim DB As Database
    Dim dbName As String

    On Error GoTo FormLoadErr

    dbName = App.Path + "\abc.mdb"
    Set DB = DBEngine.OpenDatabase(dbName, True) ' Open database exclusive
    MsgBox "Database opened successfully"
    GoTo FormLoadExit

FormLoadErr:
    MsgBox "Unable to load database ABC.MDB"
    GoTo FormLoadExit

FormLoadExit:
    Unload Me

End Sub
2. Enter the following code in the Form_Load event to load a table exclusively:
Private Sub Form_Load()

    Dim db As Database

 
< previous page page_984 next page >

If you like this book, buy it!